﻿using System.Reflection;
using System.Configuration;
namespace UtilityLibrary.Ormapping
{
    public sealed class SqlCreaterFactory
    {
        private const string c_assemblyName = "UtilityLibrary.Ormapping";

        /// <summary>
        /// 私有化构造函数
        /// </summary>
        private SqlCreaterFactory() { }

        public static ISqlCreater DriveSqlCreater()
        {
            // 获取默认构造器名称
            string constructor = ConfigurationManager.AppSettings["SqlCreater"];

            // 建立 IDataBase 对象实例
            return (ISqlCreater)Assembly.Load(c_assemblyName).CreateInstance(constructor, false);
        }
    }
}
